<template>
  <div class="flex_ard">
    <div class="leftSty">
      <div class="title">设计助手目表</div>
      <div class="listSty">
        <div v-for="(item, index) in helpList" :key="index" class="flex_btn hoverSty"
          style="padding:6px 10px; margin: 5px;" @click="goDetail(item.name, item.id)">
          <div> {{ (current - 1) * 14 + index + current }} {{ '. ' }} {{ item.name }}</div>
          <div>{{ item.priceDesc }}</div>
        </div>
      </div>
      <el-config-provider :locale="locale">
        <el-pagination class="paginSty" :page-size="15" background layout="prev, pager, next" :total="total"
        @current-change="handleCurrentChange" :hide-on-single-page="true" />
      </el-config-provider>
     
    </div>
    <div class="rightSty">
      <div v-for="(item, index) in kefu" :key="index" style="text-align: center;">
        <img :src="item.imagePath" class="kefuImgSty">
        <div style="margin:10px 0">{{ item.name }}</div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { getHelpListApi ,getKeFuImgApi} from '@/api/index/index'
import { useRouter } from 'vue-router';
// import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
// @ts-ignore
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
const locale = zhCn

const { currentRoute } = useRouter();
const router = useRouter()
const helpList = ref<any[]>([
])
const kefu = ref<any>([])
const total = ref<number>(0)
const current = ref<number>(1)
const handleCurrentChange = (e: any) => {
  console.log(e)
  getHelpList(e)
}

const getHelpList = (pageNum: number) => {
  getHelpListApi(pageNum).then((res: any) => {
    helpList.value = res.data.records
    total.value = res.data.total
    current.value = res.data.current
  })
}
const goDetail = (name: string, id: number) => {
  router.push({ path: '/helper/detail', query: { id: id, name: name } })
}
const getKeFu = () => {
    getKeFuImgApi().then((res: any) => {
        kefu.value = res.data
    })
}
onMounted(() => {
  getHelpList(1)
getKeFu()

})
</script>
<style scoped>
.hoverSty{
  font-size: 20px;
  height: 40px;
}
.hoverSty:hover{
  font-size: 24px;
  cursor:pointer;
}
.paginSty {
  position: absolute;
  bottom: 30px;
  right: 10px;
}

.kefuImgSty {
    width: 180px;
    margin-top: 20px;
}

.zhanwei {
    height: 120px;
}
.leftSty {
  position: relative;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-direction: column;
  height: 90vh;
}

.rightSty {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  height: 100vh;
}

.scrollSty {
  height: 800px;
  overflow: hidden;
}

.listSty {
  width: 900px;
}

.title {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 10px;
}

.itemSty {
  width: 900px;
  height: 40px;
  line-height: 40px;
}
</style>